<?xml version="1.0" encoding="UTF-8"?>
<!-- =====================================================================
     A W3C XML Schema for XHTML 5.
     Corresponds to W3C Candidate Recommendation 17 December 2012.

     Author: Olivier Ishacian

     Copyright (c) 2012-2013 Pixware SARL.

     Permission is hereby granted, free of charge, to any person
     obtaining a copy of this software and associated
     documentation files (the "Software"), to deal in the
     Software without restriction, including without limitation
     the rights to use, copy, modify, merge, publish, distribute,
     sublicense, and/or sell copies of the Software, and to
     permit persons to whom the Software is furnished to do so,
     subject to the following conditions:

     The above copyright notice and this permission notice shall
     be included in all copies or substantial portions of the
     Software.

     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
     KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
     WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
     PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
     OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
     OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
     OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
     SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
     ===================================================================== -->

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
	   xmlns="http://www.w3.org/1999/xhtml" 
	   xmlns:html="http://www.w3.org/1999/xhtml" 
	   xmlns:svg="http://www.w3.org/2000/svg"
           xmlns:xlink="http://www.w3.org/1999/xlink" 
	   xmlns:mml="http://www.w3.org/1998/Math/MathML" 
	   targetNamespace="http://www.w3.org/1999/xhtml"
	   elementFormDefault="qualified">

  <xs:import namespace="http://www.w3.org/XML/1998/namespace"
             schemaLocation="xml.xsd"/>

  <!-- The root element ================================================== -->

  <xs:element name="html">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="head"/>
	<xs:element ref="body"/>
      </xs:sequence>
      <xs:attributeGroup ref="globalAttributeGroup"/>
      <xs:attribute name="manifest" type="uri"/>
    </xs:complexType>

    <xs:unique name="uniqueId">
      <xs:selector xpath=".//html:*"/>
      <xs:field xpath="@id"/>
    </xs:unique>

    <xs:unique name="formId" >
      <xs:selector xpath=".//html:form"/>
      <xs:field xpath="@id"/>
    </xs:unique>

    <xs:unique name="labelableId">
      <xs:selector xpath=".//html:button|.//html:input|.//html:keygen|
                          .//html:meter|.//html:output|.//html:progress|
                          .//html:select|.//html:textarea"/>
      <xs:field xpath="@id"/>
    </xs:unique>

    <xs:unique name="datalistId" >
      <xs:selector xpath=".//html:datalist"/>
      <xs:field xpath="@id"/>
    </xs:unique>

    <xs:keyref name="objectForm" refer="formId">
      <xs:selector xpath=".//html:object"/>
      <xs:field xpath="@form"/>
    </xs:keyref>

    <xs:keyref name="fieldsetForm" refer="formId">
      <xs:selector xpath=".//html:fieldset"/>
      <xs:field xpath="@form"/>
    </xs:keyref>

    <xs:keyref name="labelFor" refer="labelableId">
      <xs:selector xpath=".//html:label"/>
      <xs:field xpath="@for"/>
    </xs:keyref>

    <xs:keyref name="labelForm" refer="formId">
      <xs:selector xpath=".//html:label"/>
      <xs:field xpath="@form"/>
    </xs:keyref>

    <xs:keyref name="inputList" refer="datalistId">
      <xs:selector xpath=".//html:input"/>
      <xs:field xpath="@list"/>
    </xs:keyref>
     
    <xs:keyref name="inputForm" refer="formId">
      <xs:selector xpath=".//html:input"/>
      <xs:field xpath="@form"/>
    </xs:keyref>

    <xs:keyref name="buttonForm" refer="formId">
      <xs:selector xpath=".//html:button"/>
      <xs:field xpath="@form"/>
    </xs:keyref>

    <xs:keyref name="selectForm" refer="formId">
      <xs:selector xpath=".//html:select"/>
      <xs:field xpath="@form"/>
    </xs:keyref>

    <xs:keyref name="textareaForm" refer="formId">
      <xs:selector xpath=".//html:textarea"/>
      <xs:field xpath="@form"/>
    </xs:keyref>

    <xs:keyref name="keygenForm" refer="formId">
      <xs:selector xpath=".//html:keygen"/>
      <xs:field xpath="@form"/>
    </xs:keyref>

    <!-- No way to check html:output/@for as WXS has no xs:keyref*s*. -->

    <xs:keyref name="outputForm" refer="formId">
      <xs:selector xpath=".//html:output"/>
      <xs:field xpath="@form"/>
    </xs:keyref>

    <xs:keyref name="progressForm" refer="formId">
      <xs:selector xpath=".//html:progress"/>
      <xs:field xpath="@form"/>
    </xs:keyref>

    <xs:keyref name="meterForm" refer="formId">
      <xs:selector xpath=".//html:meter"/>
      <xs:field xpath="@form"/>
    </xs:keyref>
  </xs:element>

  <xs:simpleType name="uri">
    <xs:restriction base="xs:anyURI"/>
  </xs:simpleType>

  <!-- Document metadata ================================================= -->

  <xs:element name="head">
    <xs:complexType>
     <xs:sequence>
       <xs:group ref="metaDataElements" minOccurs="0" maxOccurs="unbounded"/>
       <xs:element ref="title"/>
       <xs:group ref="metaDataElements" minOccurs="0" maxOccurs="unbounded"/>
     </xs:sequence>
     <xs:attributeGroup ref="globalAttributeGroup"/>
    </xs:complexType>
  </xs:element>

  <xs:element name="title">
    <xs:complexType mixed="true">
      <xs:attributeGroup ref="globalAttributeGroup"/>
    </xs:complexType>
  </xs:element>

  <xs:group name="metaDataElements">
    <xs:choice>
      <xs:element ref="base"/>
      <xs:element ref="link"/>
      <xs:element ref="style"/>
      <xs:element ref="meta"/>
      <xs:element ref="script"/>
      <xs:element ref="command"/>
    </xs:choice>
  </xs:group>

  <xs:element name="base">
    <xs:complexType>
      <xs:attributeGroup ref="globalAttributeGroup"/>
      <!-- must have either an href attribute, a target attribute, or both. -->
      <xs:attribute name="href" type="uri"/>
      <xs:attribute name="target" type="browsingContextNameOrKeyword"/>
    </xs:complexType>
  </xs:element>

  <xs:simpleType name="browsingContextNameOrKeyword">
    <xs:union>
      <xs:simpleType>
	<xs:restriction base="xs:NMTOKEN">
	  <xs:enumeration value="_blank"/>
	  <xs:enumeration value="_self"/>
	  <xs:enumeration value="_parent"/>
	  <xs:enumeration value="_top"/>
	</xs:restriction>
      </xs:simpleType>

      <xs:simpleType>
	<xs:restriction base="browsingContextName"/>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="browsingContextName">
    <xs:restriction base="xs:token">
      <xs:pattern value="[^_].*"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:element name="link">
    <xs:complexType>
      <xs:attributeGroup ref="globalAttributeGroup"/>
      <xs:attribute name="href" type="uri" use="required"/>
      <xs:attribute name="hreflang" type="languageTag"/>
      <xs:attribute name="rel" type="tokens" use="required"/>
      <xs:attribute name="media" type="mediaQueryList" default="all"/>
      <xs:attribute name="type" type="mimeType"/>
      <xs:attribute name="sizes" type="sizes"/>
    </xs:complexType>
  </xs:element>

  <xs:simpleType name="languageTag">
    <xs:restriction base="xs:language"/>
  </xs:simpleType>

  <xs:simpleType name="tokens">
    <xs:list itemType="token"/>
  </xs:simpleType>

  <xs:simpleType name="token">
    <xs:restriction base="xs:token">
      <xs:pattern value="\S+"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="mediaQueryList">
    <xs:restriction base="nonEmptyToken"/>
  </xs:simpleType>

  <xs:simpleType name="nonEmptyToken"> 
    <xs:restriction base="xs:token">
      <xs:minLength value="1"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="mimeType"> 
    <!-- A MIME type may have a parameter. 
         Example: "application/dita+xml; format=dita" -->
    <xs:restriction base="nonEmptyToken"/>
  </xs:simpleType>

  <xs:simpleType name="sizes">
    <xs:restriction base="tokens"/>
  </xs:simpleType>

  <xs:element name="meta">
    <xs:complexType>
      <xs:attributeGroup ref="globalAttributeGroup"/>
      <!-- One of: charset, name+content, http-equiv+content. 
           If http-equiv="content-type", 
           then content starts with "text/html;". -->
      <xs:attribute name="http-equiv" type="httpEquiv"/>
      <xs:attribute name="name" type="string"/>
      <xs:attribute name="content" type="string"/>
      <xs:attribute name="charset" type="charset"/>
    </xs:complexType>
  </xs:element>

  <xs:simpleType name="httpEquiv">
    <xs:restriction base="xs:NMTOKEN">
      <xs:enumeration value="content-language"/>
      <xs:enumeration value="content-type"/>
      <xs:enumeration value="default-style"/>
      <xs:enumeration value="refresh"/>
      <xs:enumeration value="set-cookie"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="string">
    <xs:restriction base="xs:string"/>
  </xs:simpleType>

  <xs:simpleType name="charset">
    <xs:restriction base="token"/>
  </xs:simpleType>

  <xs:element name="style">
    <xs:complexType mixed="true">
      <xs:attributeGroup ref="globalAttributeGroup"/>
      <xs:attribute name="type" type="mimeType" default="text/css"/>      
      <xs:attribute name="media" type="mediaQueryList" default="all"/>
      <xs:attribute name="scoped" type="scoped"/>      
    </xs:complexType>
  </xs:element>

  <xs:simpleType name="scoped">
    <xs:restriction base="xs:token">
      <xs:enumeration value="scoped"/>
      <xs:enumeration value=""/>
    </xs:restriction>
  </xs:simpleType>

  <!-- Scripting ========================================================= -->

  <xs:element name="script">
    <xs:complexType mixed="true">
      <xs:attributeGroup ref="globalAttributeGroup"/>
      <xs:attribute name="type" type="mimeType" default="text/javascript"/>
      <xs:attribute name="src" type="uri"/>
      <xs:attribute name="defer" type="defer"/>
      <xs:attribute name="async" type="async"/>
      <xs:attribute name="charset" type="charset"/>
    </xs:complexType>
  </xs:element>

  <xs:simpleType name="defer">
    <xs:restriction base="xs:token">
      <xs:enumeration value="defer"/>
      <xs:enumeration value=""/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="async">
    <xs:restriction base="xs:token">
      <xs:enumeration value="async"/>
      <xs:enumeration value=""/>
    </xs:restriction>
  </xs:simpleType>

  <!-- The noscript element must not be used in XHTML5 documents. -->

  <!-- Sections ========================================================== -->

  <xs:element name="body">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="flowContentElement">
	  <xs:attribute name="onafterprint" type="functionBody"/>
	  <xs:attribute name="onbeforeprint" type="functionBody"/>
	  <xs:attribute name="onbeforeunload" type="functionBody"/>
	  <xs:attribute name="onhashchange" type="functionBody"/>
	  <xs:attribute name="onmessage" type="functionBody"/>
	  <xs:attribute name="onoffline" type="functionBody"/>
	  <xs:attribute name="ononline" type="functionBody"/>
	  <xs:attribute name="onpagehide" type="functionBody"/>
	  <xs:attribute name="onpageshow" type="functionBody"/>
	  <xs:attribute name="onpopstate" type="functionBody"/>
	  <xs:attribute name="onredo" type="functionBody"/>
	  <xs:attribute name="onresize" type="functionBody"/>
	  <xs:attribute name="onstorage" type="functionBody"/>
	  <xs:attribute name="onundo" type="functionBody"/>
	  <xs:attribute name="onunload" type="functionBody"/>
	</xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:complexType name="flowContentElement" mixed="true">
    <xs:sequence minOccurs="0" maxOccurs="unbounded">
      <xs:group ref="flowContent"/>
    </xs:sequence>
    <xs:attributeGroup ref="globalAttributeGroup"/>
  </xs:complexType>

  <xs:simpleType name="functionBody">
    <xs:restriction base="xs:string"/>
  </xs:simpleType>

  <xs:element name="section" type="styledFlowContentElement"/>

  <xs:complexType name="styledFlowContentElement" mixed="true">
    <!-- LIMITATION: allows to have text other than whitespace
         between style elements. -->
    <xs:sequence>
      <xs:element ref="style" minOccurs="0" maxOccurs="unbounded"/>
      <xs:group ref="flowContent" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attributeGroup ref="globalAttributeGroup"/>
  </xs:complexType>

  <xs:element name="nav" type="flowContentElement"/>

  <xs:element name="article" type="styledFlowContentElement"/>

  <xs:element name="aside" type="styledFlowContentElement"/>

  <xs:element name="h1" type="phrasingContentElement"/>

  <xs:element name="h2" type="phrasingContentElement"/>

  <xs:element name="h3" type="phrasingContentElement"/>

  <xs:element name="h4" type="phrasingContentElement"/>

  <xs:element name="h5" type="phrasingContentElement"/>

  <xs:element name="h6" type="phrasingContentElement"/>

  <xs:element name="hgroup">
    <xs:complexType>
      <xs:choice maxOccurs="unbounded">
        <xs:element ref="h1"/>
        <xs:element ref="h2"/>
        <xs:element ref="h3"/>
        <xs:element ref="h4"/>
        <xs:element ref="h5"/>
        <xs:element ref="h6"/>
      </xs:choice>
      <xs:attributeGroup ref="globalAttributeGroup"/>
    </xs:complexType>
  </xs:element>

  <!-- LIMITATION: allows header, footer, address descendants. -->
  <xs:element name="header" type="flowContentElement"/>

  <!-- LIMITATION: allows header, footer, address descendants. -->
  <xs:element name="footer" type="flowContentElement"/>

  <!-- LIMITATION: allows heading content, sectioning content, 
       header, footer, address descendants. -->
  <xs:element name="address" type="flowContentElement"/>

  <!-- Grouping content ================================================== -->

  <xs:element name="p" type="phrasingContentElement"/> 

  <xs:complexType name="phrasingContentElement" mixed="true">
    <xs:sequence minOccurs="0" maxOccurs="unbounded">
      <xs:group ref="phrasingContent"/>
    </xs:sequence>
    <xs:attributeGroup ref="globalAttributeGroup"/>
  </xs:complexType>

  <xs:element name="hr">
    <xs:complexType>
      <xs:attributeGroup ref="globalAttributeGroup"/>
    </xs:complexType>
  </xs:element>

  <xs:element name="pre" type="phrasingContentElement"/>

  <xs:element name="blockquote">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="flowContentElement">
	  <xs:attribute name="cite" type="uri"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="ol">
    <xs:complexType>
      <xs:sequence minOccurs="0" maxOccurs="unbounded">
        <xs:element name="li">
          <xs:complexType>
            <xs:complexContent>
              <xs:extension base="li">
                <xs:attribute name="value" type="integer"/>
              </xs:extension>
            </xs:complexContent>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      <xs:attributeGroup ref="globalAttributeGroup"/>
      <xs:attribute name="type" type="olType" default="1"/>
      <xs:attribute name="start" type="integer"/>
      <xs:attribute name="reversed" type="reversed"/>
    </xs:complexType>
  </xs:element>

  <xs:simpleType name="olType">
    <xs:restriction base="xs:NMTOKEN">
      <xs:enumeration value="1"/>
      <xs:enumeration value="a"/>
      <xs:enumeration value="A"/>
      <xs:enumeration value="i"/>
      <xs:enumeration value="I"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="reversed">
    <xs:restriction base="xs:token">
      <xs:enumeration value="reversed"/>
      <xs:enumeration value=""/>
    </xs:restriction>
  </xs:simpleType>

  <xs:complexType name="li">
    <xs:complexContent>
      <xs:extension base="flowContentElement"/>
    </xs:complexContent>
  </xs:complexType>

  <xs:simpleType name="integer">
    <xs:restriction base="xs:integer"/>
  </xs:simpleType>

  <xs:element name="ul">
    <xs:complexType>
      <xs:sequence minOccurs="0" maxOccurs="unbounded">
        <xs:element name="li" type="li"/>
      </xs:sequence>
      <xs:attributeGroup ref="globalAttributeGroup"/>
    </xs:complexType>
  </xs:element>

  <!-- NOT A TOP ELEMENT: li -->

  <xs:element name="dl">
    <xs:complexType>
      <xs:sequence minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="dt" maxOccurs="unbounded"/>
	<xs:element ref="dd" maxOccurs="unbounded"/>
      </xs:sequence>
      <xs:attributeGroup ref="globalAttributeGroup"/>
    </xs:complexType>
  </xs:element>

  <xs:element name="dt" type="phrasingContentElement"/>
 
  <xs:element name="dd" type="flowContentElement"/>

  <xs:element name="figure"> 
    <xs:complexType mixed="true">
      <!-- LIMITATION: allows to have text other than whitespace
           before leading figcaption or trailing figcaption. -->
      <xs:choice>
        <xs:sequence>
          <xs:element ref="figcaption"/>
          <xs:group ref="flowContent" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:sequence>
          <xs:group ref="flowContent" maxOccurs="unbounded"/>
          <xs:element ref="figcaption" minOccurs="0"/>
        </xs:sequence>
      </xs:choice>
      <xs:attributeGroup ref="globalAttributeGroup"/>
    </xs:complexType>
  </xs:element>

  <xs:element name="figcaption" type="flowContentElement"/>

  <xs:element name="div" type="styledFlowContentElement"/>

  <!-- Text-level semantics ============================================== -->

  <!-- NOT A TOP ELEMENT: a -->
  <!-- LIMITATION: allows interactive content descendants. -->

  <xs:complexType name="aFlow">
    <xs:complexContent>
      <xs:extension base="flowContentElement">
        <xs:attributeGroup ref="aAttributeGroup"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:attributeGroup name="aAttributeGroup">
    <xs:attribute name="href" type="uri"/>
    <xs:attribute name="target" type="browsingContextNameOrKeyword"/>
    <xs:attribute name="rel" type="tokens"/>
    <xs:attribute name="hreflang" type="languageTag"/>
    <xs:attribute name="media" type="mediaQueryList"/>
    <xs:attribute name="type" type="mimeType"/>
  </xs:attributeGroup>

  <xs:simpleType name="id">
    <xs:restriction base="xs:token">
      <xs:pattern value="\S+"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:complexType name="aPhrasing">
    <xs:complexContent>
      <xs:extension base="phrasingContentElement">
        <xs:attributeGroup ref="aAttributeGroup"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:element name="em" type="phrasingContentElement"/>

  <xs:element name="strong" type="phrasingContentElement"/>

  <xs:element name="small" type="phrasingContentElement"/>

  <xs:element name="s" type="phrasingContentElement"/>

  <xs:element name="cite" type="phrasingContentElement"/>

  <xs:element name="q">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="phrasingContentElement">
	  <xs:attribute name="cite" type="uri"/>
	</xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="dfn" type="phrasingContentElement"/>

  <xs:element name="abbr" type="phrasingContentElement"/>

  <xs:element name="time">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="phrasingContentElement">
	  <xs:attribute name="datetime" type="dateTime"/>
	</xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:simpleType name="dateTime">
    <xs:restriction base="nonEmptyToken"/>
  </xs:simpleType>

  <xs:element name="code" type="phrasingContentElement"/>

  <xs:element name="var" type="phrasingContentElement"/>

  <xs:element name="samp" type="phrasingContentElement"/>

  <xs:element name="kbd" type="phrasingContentElement"/>

  <xs:element name="sub" type="phrasingContentElement"/>

  <xs:element name="sup" type="phrasingContentElement"/>

  <xs:element name="i" type="phrasingContentElement"/>

  <xs:element name="b" type="phrasingContentElement"/>

  <xs:element name="u" type="phrasingContentElement"/>

  <xs:element name="mark" type="phrasingContentElement"/>

  <xs:element name="ruby">
    <xs:complexType mixed="true">
      <!-- LIMITATION: allows to insert text other than whitespace 
           between the rp pair. -->
	<xs:sequence minOccurs="1" maxOccurs="unbounded">
	  <xs:group ref="phrasingContent" minOccurs="0" maxOccurs="unbounded"/>
	  <xs:choice>
	    <xs:sequence>
	      <xs:element ref="rt"/>
	    </xs:sequence>
	    <xs:sequence>
	      <xs:element ref="rp"/>
	      <xs:element ref="rt"/>
	      <xs:element ref="rp"/>
	    </xs:sequence>
	  </xs:choice>
	</xs:sequence>
      <xs:attributeGroup ref="globalAttributeGroup"/>
    </xs:complexType>
  </xs:element>

  <xs:element name="rt" type="phrasingContentElement"/>

  <xs:element name="rp" type="phrasingContentElement"/>

  <xs:element name="bdi">
    <xs:complexType mixed="true">
      <xs:sequence minOccurs="0" maxOccurs="unbounded">
	<xs:group ref="phrasingContent"/>
      </xs:sequence>
      <xs:attributeGroup ref="coreAttributeGroupNodir"/>
      <xs:attributeGroup ref="commonEventsGroup"/>
      <xs:attributeGroup ref="xmlAttributeGroup"/>
      <xs:attribute name="dir" type="dir" default="auto" />
    </xs:complexType>
  </xs:element>

  <xs:simpleType name="dir">
    <xs:restriction base="xs:NMTOKEN">
      <xs:enumeration value="ltr"/>
      <xs:enumeration value="rtl"/>
      <xs:enumeration value="auto"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:element name="bdo">
    <xs:complexType mixed="true">
      <xs:sequence minOccurs="0" maxOccurs="unbounded">
	<xs:group ref="phrasingContent"/>
      </xs:sequence>
      <xs:attributeGroup ref="coreAttributeGroupNodir"/>
      <xs:attributeGroup ref="commonEventsGroup"/>
      <xs:attributeGroup ref="xmlAttributeGroup"/>
      <xs:attribute name="dir" type="dir" use="required" />
    </xs:complexType>
  </xs:element>

  <xs:element name="span" type="phrasingContentElement"/>

  <xs:element name="br">
    <xs:complexType>
      <xs:attributeGroup ref="globalAttributeGroup"/>
    </xs:complexType>
  </xs:element>

  <xs:element name="wbr">
    <xs:complexType>
      <xs:attributeGroup ref="globalAttributeGroup"/>
    </xs:complexType>
  </xs:element>

  <!-- Edits ============================================================= -->

  <!-- ins element -->

  <xs:complexType name="insFlow">
    <xs:complexContent>
      <xs:extension base="flowContentElement">
	<xs:attribute name="cite" type="uri"/>
	<xs:attribute name="datetime" type="date"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:simpleType name="date">
    <xs:union>
      <xs:simpleType>
	<xs:restriction base="xs:date"/>
      </xs:simpleType>
       <xs:simpleType>
	<xs:restriction base="xs:dateTime"/>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:complexType name="insPhrasing">
    <xs:complexContent>
      <xs:extension base="phrasingContentElement">
	<xs:attribute name="cite" type="uri"/>
	<xs:attribute name="datetime" type="date"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- del element -->

  <xs:complexType name="delFlow">
    <xs:complexContent>
      <xs:extension base="flowContentElement">
	<xs:attribute name="cite" type="uri"/>
	<xs:attribute name="datetime" type="date"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="delPhrasing">
    <xs:complexContent>
      <xs:extension base="phrasingContentElement">
	<xs:attribute name="cite" type="uri"/>
	<xs:attribute name="datetime" type="date"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- Embedded content ================================================== -->

  <xs:element name="img">
    <xs:complexType> 
      <!-- LIMITATION: ismap and usemap are always allowed. -->
      <!-- LIMITATION: usemap pointing to a map not checked 
           (because of the hash-name reference). -->
      <xs:attributeGroup ref="globalAttributeGroup"/>
      <xs:attribute name="src" type="uri" use="required"/>
      <xs:attribute name="alt" type="nonEmptyToken"/>
      <xs:attribute name="height" type="nonNegativeInteger"/>
      <xs:attribute name="width" type="nonNegativeInteger"/>
      <xs:attribute name="usemap" type="hashNameRef"/>
      <xs:attribute name="ismap" type="ismap"/>
      <xs:attribute name="crossorigin" type="crossOrigin"/>
    </xs:complexType>
  </xs:element>

  <xs:simpleType name="nonNegativeInteger">
    <xs:restriction base="xs:nonNegativeInteger"/>
  </xs:simpleType>

  <xs:simpleType name="hashNameRef">
    <xs:restriction base="xs:token">
      <xs:pattern value="#\S+"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="ismap">
    <xs:restriction base="xs:token">
      <xs:enumeration value="ismap"/>
      <xs:enumeration value=""/>
    </xs:restriction>
  </xs:simpleType>

  <xs:element name="iframe">
    <xs:complexType>
      <!-- Must be empty in XML documents. -->
      <xs:attributeGroup ref="globalAttributeGroup"/>
      <xs:attribute name="src" type="uri"/>
      <xs:attribute name="srcdoc" type="string"/>
      <xs:attribute name="name" type="browsingContextName"/>
      <xs:attribute name="width" type="nonNegativeInteger"/>
      <xs:attribute name="height" type="nonNegativeInteger"/>
      <xs:attribute name="sandbox" type="sandBoxAllowList"/>
      <xs:attribute name="seamless" type="seamless"/>
    </xs:complexType>
  </xs:element>

  <xs:simpleType name="sandBoxAllowList">
    <xs:list itemType="sandBoxAllow"/>
  </xs:simpleType>
  <xs:simpleType name="sandBoxAllow">
    <xs:restriction base="xs:NMTOKEN">
      <xs:enumeration value="allow-same-origin"/>
      <xs:enumeration value="allow-forms"/>
      <xs:enumeration value="allow-scripts"/>
      <xs:enumeration value="allow-top-navigation"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="seamless">
    <xs:restriction base="xs:token">
      <xs:enumeration value="seamless"/>
      <xs:enumeration value=""/>
    </xs:restriction>
  </xs:simpleType>

  <xs:element name="embed">
    <xs:complexType>
      <!-- LIMITATION: may be a descendant of the a and button elements. -->
      <xs:attributeGroup ref="globalAttributeGroup"/>
      <xs:attribute name="src" type="uri"/>
      <xs:attribute name="type" type="mimeType"/>
      <xs:attribute name="height" type="nonNegativeInteger"/>
      <xs:attribute name="width" type="nonNegativeInteger"/>
      <xs:anyAttribute/>
    </xs:complexType>
  </xs:element>

  <!-- NOT A TOP ELEMENT: object -->
  <!-- LIMITATION: allows to have text other than whitespace
       between param elements. -->

  <xs:complexType name="objectFlow" mixed="true">
    <xs:sequence>
      <xs:element ref="param" minOccurs="0" maxOccurs="unbounded"/>
      <xs:group ref="flowContent" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attributeGroup ref="globalAttributeGroup"/>
    <xs:attributeGroup ref="objectAttributeGroup"/>
  </xs:complexType>

  <xs:complexType name="objectPhrasing" mixed="true">
    <xs:sequence>
      <xs:element ref="param" minOccurs="0" maxOccurs="unbounded"/>
      <xs:group ref="phrasingContent" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attributeGroup ref="globalAttributeGroup"/>
    <xs:attributeGroup ref="objectAttributeGroup"/>
  </xs:complexType>

  <xs:attributeGroup name="objectAttributeGroup">
    <xs:attribute name="data" type="uri"/>
    <xs:attribute name="type" type="mimeType"/>
    <xs:attribute name="height" type="nonNegativeInteger"/>
    <xs:attribute name="width" type="nonNegativeInteger"/>
    <xs:attribute name="usemap" type="hashNameRef"/>
    <xs:attribute name="name" type="browsingContextName"/>
    <xs:attribute name="form" type="idref"/>
  </xs:attributeGroup>

  <xs:element name="param">
    <xs:complexType>
      <xs:attributeGroup ref="globalAttributeGroup"/>
      <xs:attribute name="name" type="string" use="required"/>
      <xs:attribute name="value" type="string" use="required"/>
    </xs:complexType>
  </xs:element>

  <!-- NOT A TOP ELEMENT: video -->
  <!-- LIMITATION: allows to have text other than whitespace
       between source and track elements. -->
  <!-- LIMITATION: allow both src attribute and source elements. -->
      
  <xs:complexType name="videoFlow" mixed="true">
    <xs:sequence>
      <xs:element ref="source" minOccurs="0" maxOccurs="unbounded"/>      
      <xs:element ref="track" minOccurs="0" maxOccurs="unbounded"/>
      <xs:group ref="flowContent" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attributeGroup ref="globalAttributeGroup"/>
    <xs:attributeGroup ref="videoAttributeGroup"/>
  </xs:complexType>

  <xs:complexType name="videoPhrasing" mixed="true">
    <xs:sequence>
      <xs:element ref="source" minOccurs="0" maxOccurs="unbounded"/> 
      <xs:element ref="track" minOccurs="0" maxOccurs="unbounded"/>
      <xs:group ref="phrasingContent" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attributeGroup ref="globalAttributeGroup"/>
    <xs:attributeGroup ref="videoAttributeGroup"/>
  </xs:complexType>

  <xs:attributeGroup name="videoAttributeGroup">
    <xs:attribute name="src" type="uri"/>
    <xs:attribute name="autoplay" type="autoplay"/>
    <xs:attribute name="preload" type="preload"/>
    <xs:attribute name="controls" type="controls"/>
    <xs:attribute name="loop" type="loop"/>
    <xs:attribute name="poster" type="uri"/>
    <xs:attribute name="height" type="nonNegativeInteger"/>
    <xs:attribute name="width" type="nonNegativeInteger"/>
    <xs:attribute name="muted" type="muted"/>
    <xs:attribute name="mediagroup" type="string"/>
    <xs:attribute name="crossorigin" type="crossOrigin"/>
  </xs:attributeGroup>

  <xs:simpleType name="autoplay">
    <xs:restriction base="xs:token">
      <xs:enumeration value="autoplay"/>
      <xs:enumeration value=""/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="preload">
    <xs:restriction base="xs:token">
      <xs:enumeration value="none"/>
      <xs:enumeration value="metadata"/>
      <xs:enumeration value="auto"/>
      <xs:enumeration value=""/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="controls">
    <xs:restriction base="xs:token">
      <xs:enumeration value="controls"/>
      <xs:enumeration value=""/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="loop">
    <xs:restriction base="xs:token">
      <xs:enumeration value="loop"/>
      <xs:enumeration value=""/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="muted">
    <xs:restriction base="xs:token">
      <xs:enumeration value="muted"/>
      <xs:enumeration value=""/>
    </xs:restriction>
  </xs:simpleType>

  <!-- NOT A TOP ELEMENT: audio -->
  <!-- LIMITATION: allows to have text other than whitespace
       between source and track elements. -->
  <!-- LIMITATION: allow both src attribute and source elements. -->

  <xs:complexType name="audioFlow" mixed="true">
    <xs:sequence>
      <xs:element ref="source" minOccurs="0" maxOccurs="unbounded"/>
      <xs:element ref="track" minOccurs="0" maxOccurs="unbounded"/>
      <xs:group ref="flowContent" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attributeGroup ref="globalAttributeGroup"/>
    <xs:attributeGroup ref="audioAttributeGroup"/>
  </xs:complexType>

  <xs:complexType name="audioPhrasing" mixed="true">
    <xs:sequence>
      <xs:element ref="source" minOccurs="0" maxOccurs="unbounded"/>    
      <xs:element ref="track" minOccurs="0" maxOccurs="unbounded"/>
      <xs:group ref="phrasingContent" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attributeGroup ref="globalAttributeGroup"/>
    <xs:attributeGroup ref="audioAttributeGroup"/>
  </xs:complexType>

  <xs:attributeGroup name="audioAttributeGroup">
    <xs:attribute name="src" type="uri"/>
    <xs:attribute name="autoplay" type="autoplay"/>
    <xs:attribute name="preload" type="preload"/>
    <xs:attribute name="controls" type="controls"/>
    <xs:attribute name="loop" type="loop"/>
    <xs:attribute name="mediagroup" type="string"/>
    <xs:attribute name="crossorigin" type="crossOrigin"/>
  </xs:attributeGroup>

  <xs:element name="source">
    <xs:complexType>
      <xs:attributeGroup ref="globalAttributeGroup"/>
      <xs:attribute name="src" type="uri" use="required"/>
      <xs:attribute name="type" type="mimeType"/>
      <xs:attribute name="media" type="mediaQueryList"/>
    </xs:complexType>
  </xs:element>

  <xs:element name="track">
    <xs:complexType>
      <xs:attributeGroup ref="globalAttributeGroup"/>
      <xs:attribute name="kind" type="trackKind" default="subtitles"/>
      <xs:attribute name="src" type="uri" use="required"/>
      <xs:attribute name="srclang" type="languageTag"/>
      <xs:attribute name="label" type="string"/>
      <xs:attribute name="default" type="default"/>
    </xs:complexType>
  </xs:element>

  <xs:simpleType name="trackKind">
    <xs:restriction base="xs:NMTOKEN">
      <xs:enumeration value="subtitles"/>
      <xs:enumeration value="captions"/>
      <xs:enumeration value="descriptions"/>
      <xs:enumeration value="chapters"/>
      <xs:enumeration value="metadata"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="nonEmptyString"> 
    <xs:restriction base="xs:string">
      <xs:minLength value="1"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="default">
    <xs:restriction base="xs:token">
      <xs:enumeration value="default"/>
      <xs:enumeration value=""/>
    </xs:restriction>
  </xs:simpleType>

  <!-- NOT A TOP ELEMENT: canvas -->

  <xs:complexType name="canvasFlow">
    <xs:complexContent>
      <xs:extension base="flowContentElement">
	<xs:attribute name="height" type="nonNegativeInteger"/>
	<xs:attribute name="width" type="nonNegativeInteger"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="canvasPhrasing">
    <xs:complexContent>
      <xs:extension base="phrasingContentElement">
	<xs:attribute name="height" type="nonNegativeInteger"/>
	<xs:attribute name="width" type="nonNegativeInteger"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- NOT A TOP ELEMENT: map -->

  <xs:complexType name="mapFlow">
    <xs:complexContent>
      <xs:extension base="flowContentElement">
	<xs:attribute name="name" type="name" use="required"/>
      </xs:extension>
    </xs:complexContent>  
  </xs:complexType>

  <xs:complexType name="mapPhrasing">
    <xs:complexContent>
      <xs:extension base="phrasingContentElement">
	<xs:attribute name="name" type="name" use="required"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>  

  <xs:simpleType name="name">
    <xs:restriction base="xs:token">
      <xs:pattern value="\S+"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:element name="area">
    <xs:complexType>
      <!-- LIMITATION: it is possible to specify attribute href 
           without specifying attribute alt. -->
      <!-- LIMITATION: attribute coords not required when attribute shape is
           rect, circle or poly. -->
      <!-- LIMITATION: the content models of the different kinds of coords 
           are not enforced. -->
      <xs:attributeGroup ref="globalAttributeGroup"/>
      <xs:attribute name="alt" type="string"/>
      <xs:attribute name="href" type="uri"/>
      <xs:attribute name="target" type="browsingContextNameOrKeyword"/>
      <xs:attribute name="rel" type="tokens"/>
      <xs:attribute name="media" type="mediaQueryList"/>
      <xs:attribute name="hreflang" type="languageTag"/>
      <xs:attribute name="type" type="mimeType"/>
      <xs:attribute name="shape" type="shape" default="rect"/>
      <xs:attribute name="coords" type="coords"/>
    </xs:complexType>
  </xs:element>

  <xs:simpleType name="shape">
    <xs:restriction base="xs:NMTOKEN">
      <xs:enumeration value="rect"/>
      <xs:enumeration value="circle"/>
      <xs:enumeration value="poly"/>
      <xs:enumeration value="default"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="coords">
    <xs:restriction base="xs:token">
      <xs:pattern value="\s*(-?\d+)(\s*,\s*(-?\d+)){2,}\s*"/>
    </xs:restriction>
  </xs:simpleType>

  <!-- Tabular data ====================================================== -->

  <xs:element name="table">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="caption" minOccurs="0"/>
        <xs:element ref="colgroup" minOccurs="0" maxOccurs="unbounded"/>
        <xs:element ref="thead" minOccurs="0"/>
        <xs:choice>
          <xs:sequence>
            <xs:element ref="tfoot"/>
            <xs:choice>
              <xs:element ref="tbody" minOccurs="0" maxOccurs="unbounded"/>
              <xs:element ref="tr" maxOccurs="unbounded"/>
            </xs:choice>
          </xs:sequence>
          <xs:sequence>
            <xs:choice>
              <xs:element ref="tbody" maxOccurs="unbounded"/>    
              <xs:element ref="tr" maxOccurs="unbounded"/>
            </xs:choice>
            <xs:element ref="tfoot" minOccurs="0"/>
          </xs:sequence>
        </xs:choice>
      </xs:sequence>
      <xs:attributeGroup ref="globalAttributeGroup"/>
      <xs:attribute name="border" type="border"/>
    </xs:complexType>
  </xs:element>

  <xs:simpleType name="border">
    <xs:restriction base="xs:token">
      <xs:enumeration value=""/>
      <xs:enumeration value="1"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:element name="caption" type="flowContentElement"/>

  <xs:element name="colgroup">
    <!-- LIMITATION: the content model is actually: col* OR @span? -->
    <xs:complexType>
      <xs:sequence minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="col"/>
      </xs:sequence>
      <xs:attributeGroup ref="globalAttributeGroup"/>
      <xs:attribute name="span" type="positiveInteger"/>
    </xs:complexType>
  </xs:element>

  <xs:simpleType name="positiveInteger">
    <xs:restriction base="xs:positiveInteger"/>
  </xs:simpleType>

  <xs:element name="col">
    <xs:complexType>
      <xs:attributeGroup ref="globalAttributeGroup"/>
      <xs:attribute name="span" type="positiveInteger"/>
    </xs:complexType>
  </xs:element>

  <xs:element name="thead" type="tbody"/>

  <xs:element name="tfoot" type="tbody"/>

  <xs:element name="tbody" type="tbody"/>

  <xs:complexType name="tbody">
    <xs:sequence minOccurs="0" maxOccurs="unbounded">
      <xs:element ref="tr"/>
    </xs:sequence>
    <xs:attributeGroup ref="globalAttributeGroup"/>
  </xs:complexType>

  <xs:element name="tr">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="td"/>
        <xs:element ref="th"/>
      </xs:choice>
      <xs:attributeGroup ref="globalAttributeGroup"/>
    </xs:complexType>
  </xs:element>

  <xs:element name="td">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="flowContentElement">
          <xs:attributeGroup ref="thAttributeGroup"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:attributeGroup name="thAttributeGroup">
    <xs:attribute name="colspan" type="positiveInteger"/>
    <xs:attribute name="rowspan" type="nonNegativeInteger"/>
    <xs:attribute name="headers" type="idrefs"/>
  </xs:attributeGroup>

  <xs:simpleType name="idrefs">
    <xs:restriction base="idrefs0">
      <xs:minLength value="1"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="idrefs0">
    <xs:list itemType="idref"/>
  </xs:simpleType>

  <xs:element name="th">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="flowContentElement">
          <xs:attributeGroup ref="thAttributeGroup"/>
	  <xs:attribute name="scope" type="scope"/>
	  <xs:attribute name="abbr" type="string"/>
	</xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:simpleType name="scope">
    <xs:restriction base="xs:NMTOKEN">
      <xs:enumeration value="col"/>
      <xs:enumeration value="colgroup"/>
      <xs:enumeration value="row"/>
      <xs:enumeration value="rowgroup"/>
    </xs:restriction>
  </xs:simpleType>

  <!-- Forms ============================================================= -->

  <xs:element name="form">
    <xs:complexType>
      <!-- LIMITATION: may contain nested forms. -->
     <xs:complexContent>
        <xs:extension base="flowContentElement">
	  <xs:attribute name="action" type="uri"/>
	  <xs:attribute name="method" type="formmethod" default="get"/>
	  <xs:attribute name="enctype" type="formenctype"/>
	  <xs:attribute name="name" type="string"/>
	  <xs:attribute name="accept-charset" type="charsets"/>
	  <xs:attribute name="novalidate" type="formnovalidate"/>
	  <xs:attribute name="target" type="browsingContextNameOrKeyword"/>
	  <xs:attribute name="autocomplete" type="autocomplete"/>
	</xs:extension>
     </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:simpleType name="formmethod">
    <xs:restriction base="xs:NMTOKEN">
      <xs:enumeration value="get"/>
      <xs:enumeration value="post"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="formenctype">
    <xs:restriction base="xs:token">
      <xs:enumeration value="application/x-www-form-urlencoded"/>
      <xs:enumeration value="multipart/form-data"/>
      <xs:enumeration value="text/plain"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="formnovalidate">
    <xs:restriction base="xs:token">
      <xs:enumeration value="novalidate"/>
      <xs:enumeration value=""/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="charsets">
    <xs:list itemType="charset"/>
  </xs:simpleType>

  <xs:simpleType name="autocomplete">
    <xs:restriction base="xs:NMTOKEN">
      <xs:enumeration value="on"/>
      <xs:enumeration value="off"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:element name="fieldset">
    <!-- LIMITATION: allows to have text other than whitespace 
         before legend. -->
    <xs:complexType mixed="true">
      <xs:sequence>
        <xs:element ref="legend" minOccurs="0"/>
        <xs:group ref="flowContent" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
      <xs:attributeGroup ref="globalAttributeGroup"/>
      <xs:attribute name="name" type="string"/>
      <xs:attribute name="disabled" type="disabled"/>
      <xs:attribute name="form" type="idref"/>
    </xs:complexType>
  </xs:element>

  <xs:simpleType name="disabled">
    <xs:restriction base="xs:token">
      <xs:enumeration value="disabled"/>
      <xs:enumeration value=""/>
    </xs:restriction>
  </xs:simpleType>

  <xs:element name="legend" type="phrasingContentElement"/>

  <xs:element name="label">
    <xs:complexType>
      <!-- LIMITATION: restrictions related to labeled control 
           are not enforced. -->
      <!-- LIMITATION: may have a label descendant. -->
      <xs:complexContent>
        <xs:extension base="phrasingContentElement">
	  <xs:attribute name="for" type="idref"/>
	  <xs:attribute name="form" type="idref"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="input">
    <xs:complexType>
      <!-- LIMITATION: the allowed attributes and the data types of the
           attributes do not depend on the type attribute. -->
      <xs:attributeGroup ref="globalAttributeGroup"/>
      <xs:attribute name="accept" type="mimeTypeList"/>
      <xs:attribute name="alt" type="nonEmptyString"/>
      <xs:attribute name="autocomplete" type="autocomplete"/>
      <xs:attribute name="autofocus" type="autofocus"/>
      <xs:attribute name="checked" type="checked"/>
      <xs:attribute name="dirname" type="string"/>
      <xs:attribute name="disabled" type="disabled"/>
      <xs:attribute name="form" type="idref"/>
      <xs:attribute name="formaction" type="uri"/>
      <xs:attribute name="formenctype" type="formenctype"/>
      <xs:attribute name="formmethod" type="formmethod"/>
      <xs:attribute name="formnovalidate" type="formnovalidate"/>
      <xs:attribute name="formtarget" type="browsingContextNameOrKeyword"/>
      <xs:attribute name="height" type="nonNegativeInteger"/>
      <xs:attribute name="list" type="idref"/>
      <xs:attribute name="max" type="string"/>
      <xs:attribute name="maxlength" type="positiveInteger"/>
      <xs:attribute name="min" type="string"/>
      <xs:attribute name="multiple" type="multiple"/>
      <xs:attribute name="name" type="string"/>
      <xs:attribute name="pattern" type="pattern"/>
      <xs:attribute name="placeholder" type="string"/>
      <xs:attribute name="readonly" type="readonly"/>
      <xs:attribute name="required" type="required"/>
      <xs:attribute name="size" type="positiveInteger"/>
      <xs:attribute name="src" type="uri"/>
      <xs:attribute name="step" type="stepFloat"/>
      <xs:attribute name="type" type="inputType" default="text"/>
      <xs:attribute name="value" type="string"/>
      <xs:attribute name="width" type="nonNegativeInteger"/>
    </xs:complexType>
  </xs:element>

  <xs:simpleType name="inputType">
    <xs:restriction base="xs:NMTOKEN">
      <xs:enumeration value="button"/>
      <xs:enumeration value="checkbox"/>
      <xs:enumeration value="color"/>
      <xs:enumeration value="date"/>
      <xs:enumeration value="datetime"/>
      <xs:enumeration value="datetime-local"/>
      <xs:enumeration value="email"/>
      <xs:enumeration value="file"/>
      <xs:enumeration value="hidden"/>
      <xs:enumeration value="image"/>
      <xs:enumeration value="month"/>
      <xs:enumeration value="number"/>
      <xs:enumeration value="password"/>
      <xs:enumeration value="radio"/>
      <xs:enumeration value="range"/>
      <xs:enumeration value="reset"/>
      <xs:enumeration value="search"/>
      <xs:enumeration value="submit"/>
      <xs:enumeration value="text"/>
      <xs:enumeration value="tel"/>
      <xs:enumeration value="time"/>
      <xs:enumeration value="url"/>
      <xs:enumeration value="week"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="mimeTypeList">
    <xs:restriction base="xs:token">
      <xs:pattern value="\s*([a-zA-Z\-]+/[a-zA-Z0-9.+\-]+)(\s*,\s*([a-zA-Z\-]+/[a-zA-Z0-9.+\-]+))*\s*"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="autofocus">
    <xs:restriction base="xs:token">
      <xs:enumeration value="autofocus"/>
      <xs:enumeration value=""/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="readonly">
    <xs:restriction base="xs:token">
      <xs:enumeration value="readonly"/>
      <xs:enumeration value=""/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="pattern">
    <!-- A JavaScript regexp. -->
    <xs:restriction base="xs:string"/>
  </xs:simpleType>

  <xs:simpleType name="required">
    <xs:restriction base="xs:token">
      <xs:enumeration value="required"/>
      <xs:enumeration value=""/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="checked">
    <xs:restriction base="xs:token">
      <xs:enumeration value="checked"/>
      <xs:enumeration value=""/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="multiple">
    <xs:restriction base="xs:token">
      <xs:enumeration value="multiple"/>
      <xs:enumeration value=""/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="stepFloat">
    <xs:union>
      <xs:simpleType>
	<xs:restriction base="xs:NMTOKEN">
	  <xs:enumeration value="any"/>
	</xs:restriction>
      </xs:simpleType>
      <xs:simpleType>
	<xs:restriction base="positiveFloat"/>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="positiveFloat">
    <xs:restriction base="float">
      <xs:minExclusive value="0"/> 
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="float">
    <xs:restriction base="xs:double"/>
  </xs:simpleType>

  <xs:element name="button">
    <xs:complexType>
      <!-- LIMITATION: the allowed attributes do not depend on the type
           attribute. -->
      <xs:complexContent>
        <xs:extension base="phrasingContentElement">
	  <xs:attribute name="name" type="string"/>
	  <xs:attribute name="disabled" type="disabled"/>
	  <xs:attribute name="form" type="idref"/>
	  <xs:attribute name="type" type="buttonType" default="submit"/>
	  <xs:attribute name="value" type="string"/>
	  <xs:attribute name="formaction" type="uri"/>
	  <xs:attribute name="autofocus" type="autofocus"/>
	  <xs:attribute name="formenctype" type="formenctype"/>
	  <xs:attribute name="formmethod" type="formmethod"/>
	  <xs:attribute name="formtarget" type="browsingContextNameOrKeyword"/>
	  <xs:attribute name="formnovalidate" type="formnovalidate"/>
	</xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:simpleType name="buttonType">
    <xs:restriction base="xs:NMTOKEN">
      <xs:enumeration value="button"/>
      <xs:enumeration value="reset"/>
      <xs:enumeration value="submit"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:element name="select">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="option"/>
        <xs:element ref="optgroup"/>
      </xs:choice>
      <xs:attributeGroup ref="globalAttributeGroup"/>
      <xs:attribute name="name" type="string"/>
      <xs:attribute name="disabled" type="disabled"/>
      <xs:attribute name="form" type="idref"/>
      <xs:attribute name="size" type="positiveInteger"/>
      <xs:attribute name="multiple" type="multiple"/>
      <xs:attribute name="autofocus" type="autofocus"/>
      <xs:attribute name="required" type="required"/>
    </xs:complexType>
  </xs:element>

  <xs:element name="datalist">
    <xs:complexType mixed="true">
      <xs:choice>
        <xs:element ref="option" minOccurs="0" maxOccurs="unbounded"/>
        <xs:group ref="phrasingContent" minOccurs="0" maxOccurs="unbounded"/>
      </xs:choice>
      <xs:attributeGroup ref="globalAttributeGroup"/>
    </xs:complexType>
  </xs:element>

  <xs:element name="optgroup">
    <xs:complexType>
      <xs:sequence minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="option"/>
      </xs:sequence>
      <xs:attributeGroup ref="globalAttributeGroup"/>
      <xs:attribute name="label" type="string" use="required"/>
      <xs:attribute name="disabled" type="disabled"/>
    </xs:complexType>
  </xs:element>

  <xs:element name="option">
    <xs:complexType mixed="true">
      <xs:attributeGroup ref="globalAttributeGroup"/>
      <xs:attribute name="disabled" type="disabled"/>
      <xs:attribute name="selected" type="selected"/>
      <xs:attribute name="label" type="string"/>
      <xs:attribute name="value" type="string"/>
    </xs:complexType>
  </xs:element>

  <xs:simpleType name="selected">
    <xs:restriction base="xs:token">
      <xs:enumeration value="selected"/>
      <xs:enumeration value=""/>
    </xs:restriction>
  </xs:simpleType>

  <xs:element name="textarea">
    <xs:complexType mixed="true">
      <!-- LIMITATION: having attribute wrap=hard does not make attribute cols
           required. -->
      <xs:attributeGroup ref="globalAttributeGroup"/>
      <xs:attribute name="name" type="string"/>
      <xs:attribute name="disabled" type="disabled"/>
      <xs:attribute name="form" type="idref"/>
      <xs:attribute name="readonly" type="readonly"/>
      <xs:attribute name="maxlength" type="positiveInteger"/>
      <xs:attribute name="autofocus" type="autofocus"/>
      <xs:attribute name="required" type="required"/>
      <xs:attribute name="placeholder" type="string"/>
      <xs:attribute name="rows" type="positiveInteger"/>
      <xs:attribute name="cols" type="positiveInteger"/>
      <xs:attribute name="wrap" type="wrap" default="soft"/>
    </xs:complexType>
  </xs:element>

  <xs:simpleType name="wrap">
    <xs:restriction base="xs:NMTOKEN">
      <xs:enumeration value="hard"/>
      <xs:enumeration value="soft"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:element name="keygen">
    <xs:complexType>
      <xs:attributeGroup ref="globalAttributeGroup"/>
      <xs:attribute name="challenge" type="string"/>
      <xs:attribute name="keytype" type="keytype"/>
      <xs:attribute name="autofocus" type="autofocus"/>
      <xs:attribute name="name" type="string"/>
      <xs:attribute name="disabled" type="disabled"/>
      <xs:attribute name="form" type="idref"/>
    </xs:complexType>
  </xs:element>

  <xs:simpleType name="keytype">
    <xs:restriction base="xs:NMTOKEN">
      <xs:enumeration value="rsa"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:element name="output">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="phrasingContentElement">
	  <xs:attribute name="name" type="string"/>
	  <xs:attribute name="form" type="idref"/>
	  <xs:attribute name="for" type="idrefs"/>
	</xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="progress">
    <xs:complexType>
      <!-- LIMITATION: may contain a nested progress element. -->
      <!-- LIMITATION: value and max may be inconsistent. -->
      <xs:complexContent>
        <xs:extension base="phrasingContentElement">
          <xs:attribute name="value" type="nonNegativeFloat"/>
          <xs:attribute name="max" type="positiveFloat"/>
	  <xs:attribute name="form" type="idref"/>
	</xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:simpleType name="nonNegativeFloat">
    <xs:restriction base="float">
      <xs:minInclusive value="0"/> 
    </xs:restriction>
  </xs:simpleType>

  <xs:element name="meter">
    <xs:complexType>
      <!-- LIMITATION: may contain a nested meter element. -->
      <!-- LIMITATION: value, min, max, etc, may be inconsistent. -->
      <xs:complexContent>
        <xs:extension base="phrasingContentElement">
	  <xs:attribute name="value" type="float" use="required"/>
	  <xs:attribute name="min" type="float"/>
	  <xs:attribute name="low" type="float"/>
	  <xs:attribute name="high" type="float"/>
	  <xs:attribute name="max" type="float"/>
	  <xs:attribute name="optimum" type="float"/>
	  <xs:attribute name="form" type="idref"/>
	</xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <!-- Interactive elements ============================================== -->

  <xs:element name="details">
    <xs:complexType mixed="true">
      <xs:sequence>
        <!-- LIMITATION: allows to have text other than whitespace
             before summary. -->
        <xs:element ref="summary" minOccurs="0"/>
        <xs:group ref="flowContent" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
      <xs:attributeGroup ref="globalAttributeGroup"/>
      <xs:attribute name="open" type="open"/>
    </xs:complexType>
  </xs:element>

  <xs:simpleType name="open">
    <xs:restriction base="xs:token">
      <xs:enumeration value="open"/>
      <xs:enumeration value=""/>
    </xs:restriction>
  </xs:simpleType>

  <xs:element name="summary" type="phrasingContentElement"/>

  <xs:element name="command">
    <xs:complexType>
      <!-- LIMITATION: the allowed attributes do not depend on the type
           attribute. -->
      <xs:attributeGroup ref="globalAttributeGroup"/>
      <xs:attribute name="type" type="commandType" default="command"/>
      <xs:attribute name="label" type="string"/>
      <xs:attribute name="icon" type="uri"/>
      <xs:attribute name="disabled" type="disabled"/>
      <xs:attribute name="radiogroup" type="string"/>
      <xs:attribute name="checked" type="checked"/>
    </xs:complexType>
  </xs:element>

  <xs:simpleType name="commandType">
    <xs:restriction base="xs:NMTOKEN">
      <xs:enumeration value="command"/>
      <xs:enumeration value="radio"/>
      <xs:enumeration value="checkbox"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:element name="menu">
    <xs:complexType mixed="true">
        <!-- LIMITATION: allows to have text other than whitespace
             between li child elements. -->
      <xs:choice>
        <xs:element name="li" type="li" minOccurs="0" maxOccurs="unbounded"/>
        <xs:group ref="flowContent" minOccurs="0" maxOccurs="unbounded"/>
      </xs:choice>
      <xs:attributeGroup ref="globalAttributeGroup"/>
      <xs:attribute name="type" type="menuType"/>
      <xs:attribute name="label" type="string"/>
    </xs:complexType>
  </xs:element>

  <xs:simpleType name="menuType">
    <xs:restriction base="xs:NMTOKEN">
      <xs:enumeration value="context"/>
      <xs:enumeration value="toolbar"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:element name="dialog">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="flowContentElement">
	  <xs:attribute name="open" type="open"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <!-- Global Attributes ================================================= -->

  <xs:attributeGroup name="globalAttributeGroup">
    <xs:attributeGroup ref="coreAttributeGroup"/>
    <xs:attributeGroup ref="commonEventsGroup"/>
    <xs:attributeGroup ref="xmlAttributeGroup"/>
  </xs:attributeGroup>

  <xs:attributeGroup name="coreAttributeGroupNodir">
    <xs:attribute name="accesskey" type="accesskey"/>
    <xs:attribute name="class" type="tokens"/>
    <xs:attribute name="contenteditable" type="implicitBoolean"/>
    <xs:attribute name="contextmenu" type="idref"/>
    <xs:attribute name="draggable" type="implicitBoolean"/>
    <xs:attribute name="dropzone" type="dropzone"/>
    <xs:attribute name="hidden" type="hidden"/>
    <xs:attribute name="id" type="id"/>
    <xs:attribute name="lang" type="languageTag"/>
    <xs:attribute name="spellcheck" type="implicitBoolean"/>
    <xs:attribute name="style" type="string"/>
    <xs:attribute name="tabindex" type="integer"/>
    <xs:attribute name="title" type="string"/>
    <xs:attribute name="translate" type="yesOrno"/>
  </xs:attributeGroup>

  <xs:simpleType name="accesskey">
    <xs:list>
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:pattern value="\S"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:list>
  </xs:simpleType>

  <xs:simpleType name="dropzone">
    <xs:list>
      <xs:simpleType>
        <xs:union>
          <xs:simpleType>
            <xs:restriction base="xs:NMTOKEN">
              <xs:enumeration value="copy"/>
              <xs:enumeration value="move"/>
              <xs:enumeration value="link"/>
            </xs:restriction>
          </xs:simpleType>

          <xs:simpleType>
            <xs:restriction base="xs:token">
              <xs:pattern value="string:\S+"/>
            </xs:restriction>
          </xs:simpleType>

          <xs:simpleType>
            <xs:restriction base="xs:token">
              <xs:pattern value="file:\S+"/>
            </xs:restriction>
          </xs:simpleType>
        </xs:union>
      </xs:simpleType>
    </xs:list>
  </xs:simpleType>

  <xs:simpleType name="hidden">
    <xs:restriction base="xs:token">
      <xs:enumeration value="hidden"/>
      <xs:enumeration value=""/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="crossOrigin">
    <xs:restriction base="xs:NMTOKEN">
      <xs:enumeration value="anonymous"/>
      <xs:enumeration value="use-credentials"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="idref">
    <xs:restriction base="xs:token">
      <xs:pattern value="\S+"/>
    </xs:restriction>
  </xs:simpleType>
    
  <xs:simpleType name="boolean">
    <xs:restriction base="xs:boolean"/>
  </xs:simpleType>

  <xs:simpleType name="implicitBoolean">
    <xs:restriction base="xs:token">
      <xs:enumeration value="true"/>
      <xs:enumeration value="false"/>
      <xs:enumeration value=""/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="yesOrno">
    <xs:restriction base="xs:token">
      <xs:enumeration value="yes"/>
      <xs:enumeration value="no"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:attributeGroup name="coreAttributeGroup">
    <xs:attributeGroup ref="coreAttributeGroupNodir"/>
    <xs:attribute name="dir" type="dir" />
  </xs:attributeGroup>

  <xs:attributeGroup name="commonEventsGroup">
    <xs:attribute name="onabort" type="functionBody"/>
    <xs:attribute name="onblur" type="functionBody"/>
    <xs:attribute name="oncanplay" type="functionBody"/>
    <xs:attribute name="oncanplaythrough" type="functionBody"/>
    <xs:attribute name="onchange" type="functionBody"/>
    <xs:attribute name="onclick" type="functionBody"/>
    <xs:attribute name="oncontextmenu" type="functionBody"/>
    <xs:attribute name="ondblclick" type="functionBody"/>
    <xs:attribute name="ondrag" type="functionBody"/>
    <xs:attribute name="ondragend" type="functionBody"/>
    <xs:attribute name="ondragenter" type="functionBody"/>
    <xs:attribute name="ondragleave" type="functionBody"/>
    <xs:attribute name="ondragover" type="functionBody"/>
    <xs:attribute name="ondragstart" type="functionBody"/>
    <xs:attribute name="ondrop" type="functionBody"/>
    <xs:attribute name="ondurationchange" type="functionBody"/>
    <xs:attribute name="onemptied" type="functionBody"/>
    <xs:attribute name="onended" type="functionBody"/>
    <xs:attribute name="onerror" type="functionBody"/>
    <xs:attribute name="onfocus" type="functionBody"/>
    <xs:attribute name="oninput" type="functionBody"/>
    <xs:attribute name="oninvalid" type="functionBody"/>
    <xs:attribute name="onkeydown" type="functionBody"/>
    <xs:attribute name="onkeypress" type="functionBody"/>
    <xs:attribute name="onkeyup" type="functionBody"/>
    <xs:attribute name="onload" type="functionBody"/>
    <xs:attribute name="onloadeddata" type="functionBody"/>
    <xs:attribute name="onloadedmetadata" type="functionBody"/>
    <xs:attribute name="onloadstart" type="functionBody"/>
    <xs:attribute name="onmousedown" type="functionBody"/>
    <xs:attribute name="onmousemove" type="functionBody"/>
    <xs:attribute name="onmouseout" type="functionBody"/>
    <xs:attribute name="onmouseover" type="functionBody"/>
    <xs:attribute name="onmouseup" type="functionBody"/>
    <xs:attribute name="onmousewheel" type="functionBody"/>
    <xs:attribute name="onpause" type="functionBody"/>
    <xs:attribute name="onplay" type="functionBody"/>
    <xs:attribute name="onplaying" type="functionBody"/>
    <xs:attribute name="onprogress" type="functionBody"/>
    <xs:attribute name="onratechange" type="functionBody"/>
    <xs:attribute name="onreadystatechange" type="functionBody"/>
    <xs:attribute name="onreset" type="functionBody"/>
    <xs:attribute name="onscroll" type="functionBody"/>
    <xs:attribute name="onseeked" type="functionBody"/>
    <xs:attribute name="onseeking" type="functionBody"/>
    <xs:attribute name="onselect" type="functionBody"/>
    <xs:attribute name="onshow" type="functionBody"/>
    <xs:attribute name="onstalled" type="functionBody"/>
    <xs:attribute name="onsubmit" type="functionBody"/>
    <xs:attribute name="onsuspend" type="functionBody"/>
    <xs:attribute name="ontimeupdate" type="functionBody"/>
    <xs:attribute name="onvolumechange" type="functionBody"/>
    <xs:attribute name="onwaiting" type="functionBody"/>
  </xs:attributeGroup>

  <xs:attributeGroup name="xmlAttributeGroup">
    <xs:attribute ref="xml:lang"/>
    <xs:attribute ref="xml:space"/>
    <xs:attribute ref="xml:base"/>
  </xs:attributeGroup>

  <!-- Common content models ============================================= -->

  <xs:group name="flowContent">
    <xs:choice>
      <xs:group ref="commonPhrasingElements"/>
      <xs:element name="a" type="aFlow"/>
      <xs:element ref="p"/>
      <xs:element ref="hr"/>
      <xs:element ref="pre"/>
      <xs:element ref="ul"/>
      <xs:element ref="ol"/>
      <xs:element ref="dl"/>
      <xs:element ref="div"/>
      <xs:element ref="h1"/>
      <xs:element ref="h2"/>
      <xs:element ref="h3"/>
      <xs:element ref="h4"/>
      <xs:element ref="h5"/>
      <xs:element ref="h6"/>
      <xs:element ref="hgroup"/>
      <xs:element ref="blockquote"/>
      <xs:element ref="address"/>
      <xs:element name="ins" type="insFlow"/>
      <xs:element name="del" type="delFlow"/>
      <xs:element name="object" type="objectFlow"/>
      <xs:element name="map" type="mapFlow"/>
      <xs:element ref="section"/>
      <xs:element ref="nav"/>
      <xs:element ref="article"/>
      <xs:element ref="aside"/>
      <xs:element ref="header"/>
      <xs:element ref="footer"/>
      <xs:element name="video" type="videoFlow"/>
      <xs:element name="audio" type="audioFlow"/>
      <xs:element ref="figure"/>
      <xs:element ref="table"/>
      <xs:element ref="form"/>
      <xs:element ref="fieldset"/>
      <xs:element ref="menu"/>
      <xs:element name="canvas" type="canvasFlow"/>
      <xs:element ref="details"/>
      <xs:element ref="dialog"/>
    </xs:choice>
  </xs:group>

  <xs:group name="commonPhrasingElements">
    <xs:choice>
      <xs:element ref="abbr"/>
      <xs:element ref="area"/>
      <xs:element ref="b"/>
      <xs:element ref="bdi"/>
      <xs:element ref="bdo"/>
      <xs:element ref="br"/>
      <xs:element ref="button"/>
      <xs:element ref="cite"/>
      <xs:element ref="code"/>
      <xs:element ref="command"/>
      <xs:element ref="datalist"/>
      <xs:element ref="dfn"/>
      <xs:element ref="em"/>
      <xs:element ref="embed"/>
      <xs:element ref="i"/>
      <xs:element ref="iframe"/>
      <xs:element ref="img"/>
      <xs:element ref="input"/>
      <xs:element ref="kbd"/>
      <xs:element ref="keygen"/>
      <xs:element ref="label"/>
      <xs:element ref="mark"/>
      <xs:element ref="meter"/>
      <xs:element ref="output"/>
      <xs:element ref="progress"/>
      <xs:element ref="q"/>
      <xs:element ref="ruby"/>
      <xs:element ref="s"/>
      <xs:element ref="samp"/>
      <xs:element ref="script"/>
      <xs:element ref="select"/>
      <xs:element ref="small"/>
      <xs:element ref="span"/>
      <xs:element ref="strong"/>
      <xs:element ref="sub"/>
      <xs:element ref="sup"/>
      <xs:element ref="textarea"/>
      <xs:element ref="time"/>
      <xs:element ref="u"/>
      <xs:element ref="var"/>
      <xs:element ref="wbr"/>
      <xs:any namespace="http://www.w3.org/2000/svg" 
              processContents="skip"/>
      <xs:any namespace="http://www.w3.org/1998/Math/MathML" 
              processContents="skip"/>
    </xs:choice>
  </xs:group>

  <xs:group name="phrasingContent">
    <xs:choice>
      <xs:group ref="commonPhrasingElements"/> 
      <xs:element name="a" type="aPhrasing"/>
      <xs:element name="audio" type="audioPhrasing"/>
      <xs:element name="canvas" type="canvasPhrasing"/>
      <xs:element name="del" type="delPhrasing"/>
      <xs:element name="ins" type="insPhrasing"/>
      <xs:element name="map" type="mapPhrasing"/>
      <xs:element name="object" type="objectPhrasing"/>
      <xs:element name="video" type="videoPhrasing"/>
    </xs:choice>
  </xs:group>

</xs:schema>
